package org.lazygamerz.gui.toolactions;

import java.awt.Point;

import javax.swing.JFrame;

import org.lazygamerz.gui.util.GrandExchangeGUI;
import org.rsbot.gui.BotGUI;
import org.rsbot.gui.toolactions.Base;


public class GEGui extends Base {

	private static final long serialVersionUID = -5947567636571897961L;
	private BotGUI gui;

	public GEGui(BotGUI gui) {
		this.gui = gui;
	}

	@Override
	public void actionPerformed(final java.awt.event.ActionEvent e) {
		// Prevent morons from repeatedly opening new windows.
		// Only one at a time allowed.
		if (gui.GETool!=null)  {
			gui.GETool.requestFocus();
			return;
		}

		JFrame item = new GrandExchangeGUI(gui);
		gui.GETool = item;
				
		item.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		
		Point loc = gui.getLocation();
		loc.x += gui.getWidth()+1;
		
		item.setLocation(loc);
		item.setVisible(true);
	}
}
